'use strict';

function getAndRemoveLastElement(stack){
	var last,
		result = stack.pop();

	if( stack.length === 0 ){
		return result;
	} else {
		last = getAndRemoveLastElement(stack);
		stack.push(result);
		return last;
	}
}

function reverse(stack){
	var i;
	if( stack.length === 0 ){
		return false;
	}
	i = getAndRemoveElement(stack);
	reverse(stack);
	stack.push(i);
}

var stack = [1,2,3];
reverse(stack);
	
